import { getCstAmtListForPage } from '../../services/capital/cstFundPool';
import { message } from 'antd';

export default {
    namespace: 'cstFundPool',
    state: {
        page: {},
        list: [],
        dataSource: {},

    },
    reducers: {
        /**
         * 刷新state
         *
         * @param state
         */
        refreshState(state, { payload }) {
            return { ...state, ...payload };
        }
    },
    effects: {
        /**
         * 查询租户集合
         *
         * @param call
         * @param put
         * @param select
         */
            *getCstAmtListForPage({ payload }, { call, put, select }) {
            const res = yield call(getCstAmtListForPage, { ...payload });
            if (res.data.resultCode === "ok") {
                let content = res.data.content;
                yield put({
                    type: 'refreshState',
                    payload: {
                        list: content.list,
                        page: content.page
                    }
                });
            } else {
                message.error(res.data.errMessage);
            }
        },
    },
};
